<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>/home/zjh/git/Koala-UI/KoalaUI/WebContent/lib/Koala_DateTimePicker.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><img src="../assets/css/logo.png" title=""></h1>
            
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: </em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
            <li><a href="#api-modules">Modules</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="../classes/Accordion.html">Accordion</a></li>
            
                <li><a href="../classes/AutoComplete.html">AutoComplete</a></li>
            
                <li><a href="../classes/Button.html">Button</a></li>
            
                <li><a href="../classes/Carousel.html">Carousel</a></li>
            
                <li><a href="../classes/ColorPicker.html">ColorPicker</a></li>
            
                <li><a href="../classes/Combobox.html">Combobox</a></li>
            
                <li><a href="../classes/DateTimePicker.html">DateTimePicker</a></li>
            
                <li><a href="../classes/Grid.html">Grid</a></li>
            
                <li><a href="../classes/ListView.html">ListView</a></li>
            
                <li><a href="../classes/Popover.html">Popover</a></li>
            
                <li><a href="../classes/ProgressBar.html">ProgressBar</a></li>
            
                <li><a href="../classes/RichTextEditor.html">RichTextEditor</a></li>
            
                <li><a href="../classes/ScrollSpy.html">ScrollSpy</a></li>
            
                <li><a href="../classes/Select.html">Select</a></li>
            
                <li><a href="../classes/SideBar.html">SideBar</a></li>
            
                <li><a href="../classes/Slider.html">Slider</a></li>
            
                <li><a href="../classes/Spinner.html">Spinner</a></li>
            
                <li><a href="../classes/Tab.html">Tab</a></li>
            
                <li><a href="../classes/ToolBar.html">ToolBar</a></li>
            
                <li><a href="../classes/Tooltip.html">Tooltip</a></li>
            
                <li><a href="../classes/Tree.html">Tree</a></li>
            
                <li><a href="../classes/Wizard.html">Wizard</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
            </ul>
        </div>
    </div>
</div>

            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked>
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>


            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1 class="file-heading">File: /home/zjh/git/Koala-UI/KoalaUI/WebContent/lib/Koala_DateTimePicker.js</h1>

<div class="file">
    <pre class="code prettyprint linenums">
/**
 * @author zjh
 */
+function ($) {
	&quot;use strict&quot;;
	  var smartPhone = (window.orientation != undefined);
	  /**
	   * 日期时间选择器
	   * @class DateTimePicker
	   * @constructor
	   * @example
	   *	js代码
	   *	$(function(){
	   *		var datetimepicker = $(&#x27;#datetimepicker1&#x27;).datetimepicker({
	   *			 language: &#x27;zh-CN&#x27;,
	   *			 pickDate: true,
	   *			 pickTime: true,
	   *			 pick12HourFormat:true
	   *		});
	   *	});
	   *
	   * @example
	   *	html代码
	   *	&lt;div class=&quot;container&quot;&gt;
	   *		&lt;div class=&quot;col-lg-6&quot;&gt;
	   *			&lt;div id=&quot;datetimepicker1&quot;  class=&quot;input-group&quot;&gt;
	   *				&lt;input type=&quot;text&quot;  class=&quot;form-control&quot;&gt;&lt;/input&gt;
	   *				&lt;span class=&quot;input-group-btn add-on input-append&quot;&gt;
	   *				    &lt;i data-time-icon=&quot;icon-time&quot; data-date-icon=&quot;icon-calendar&quot;&gt;&lt;/i&gt;
	   *				&lt;/span&gt;
	   *			&lt;/div&gt;
	   *		&lt;/div&gt;
	   *	&lt;/div&gt;
	   */
	  var DateTimePicker = function(element, options) {
	    this.id = dpgId++;
	    this.init(element, options);
	  };
	
	  var dateToDate = function(dt) {
	    if (typeof dt === &#x27;string&#x27;) {
	      return new Date(dt);
	    }
	    return dt;
	  };
	
	  DateTimePicker.prototype = {
		
	    constructor: DateTimePicker,
	    
	    init: function(element, options) {
	      var icon;
	      if (!(options.pickTime || options.pickDate))
	        throw new Error(&#x27;Must choose at least one picker&#x27;);
	      this.options = options;
	      this.$element = $(element);
	      this.language = options.language in dates ? options.language : &#x27;en&#x27;;
	      this.pickDate = options.pickDate;
	      this.pickTime = options.pickTime;
	      this.isInput = this.$element.is(&#x27;input&#x27;);
	      this.component = false;
	      if (this.$element.find(&#x27;.input-append&#x27;) || this.$element.find(&#x27;.input-prepend&#x27;))
	          this.component = this.$element.find(&#x27;.add-on&#x27;);
	      this.format = options.format;
	      if (!this.format) {
	        if (this.isInput){
	        	this.format = this.$element.data(&#x27;format&#x27;);
	        } else {
	        	this.format = this.$element.find(&#x27;input&#x27;).data(&#x27;format&#x27;);
	        }
	        if (!this.format){
	        	if(this.pickDate &amp;&amp; !this.pickTime){
	        		this.format = &#x27;yyyy-MM-dd&#x27;;
	        	}else if(!this.pickDate &amp;&amp; this.pickTime){
	        		if(this.options.pick12HourFormat){
	        			this.format = &#x27;HH:mm:ss PP&#x27;;	
	        		}else{
	        			this.format = &#x27;hh:mm:ss&#x27;;
	        		}
	        	}else{
	        		if(this.options.pick12HourFormat){
	        			this.format = &#x27;yyyy-MM-dd HH:mm:ss PP&#x27;;	
	        		}else{
	        			this.format = &#x27;yyyy-MM-dd hh:mm:ss&#x27;;
	        		}
	        	}
	        }
	      }else{
	    	  if(this.options.pick12HourFormat){
	    		  this.format = this.format.replace(&#x27;hh&#x27;,&#x27;HH&#x27;);
	    	  }else{
	    		  this.format = this.format.replace(&#x27;HH&#x27;,&#x27;hh&#x27;);  
	    		  this.format = this.format.replace(&#x27;PP&#x27;,&#x27;&#x27;);
	    	  }
	      }
	      this._compileFormat();
	      if (this.component) {
	        icon = this.component.find(&#x27;i&#x27;);
	      }
	      if (this.pickTime) {
	        if (icon &amp;&amp; icon.length) this.timeIcon = icon.data(&#x27;time-icon&#x27;);
	        if (!this.timeIcon) this.timeIcon = &#x27;icon-time&#x27;;
	        icon.addClass(this.timeIcon);
	      }
	      if (this.pickDate) {
	        if (icon &amp;&amp; icon.length) this.dateIcon = icon.data(&#x27;date-icon&#x27;);
	        if (!this.dateIcon) this.dateIcon = &#x27;icon-calendar&#x27;;
	        icon.removeClass(this.timeIcon);
	        icon.addClass(this.dateIcon);
	      }
	      this.widget = $(getTemplate(this.timeIcon, options.pickDate, options.pickTime, options.pick12HourFormat, options.pickSeconds, options.collapse)).appendTo(&#x27;body&#x27;);
	      this.minViewMode = options.minViewMode||this.$element.data(&#x27;date-minviewmode&#x27;)||0;
	      if (typeof this.minViewMode === &#x27;string&#x27;) {
	        switch (this.minViewMode) {
	          case &#x27;months&#x27;:
	            this.minViewMode = 1;
	          break;
	          case &#x27;years&#x27;:
	            this.minViewMode = 2;
	          break;
	          default:
	            this.minViewMode = 0;
	          break;
	        }
	      }
	      this.viewMode = options.viewMode||this.$element.data(&#x27;date-viewmode&#x27;)||0;
	      if (typeof this.viewMode === &#x27;string&#x27;) {
	        switch (this.viewMode) {
	          case &#x27;months&#x27;:
	            this.viewMode = 1;
	          break;
	          case &#x27;years&#x27;:
	            this.viewMode = 2;
	          break;
	          default:
	            this.viewMode = 0;
	          break;
	        }
	      }
	      this.startViewMode = this.viewMode;
	      this.weekStart = options.weekStart||this.$element.data(&#x27;date-weekstart&#x27;)||0;
	      this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
	      this.setStartDate(options.startDate || this.$element.data(&#x27;date-startdate&#x27;));
	      this.setEndDate(options.endDate || this.$element.data(&#x27;date-enddate&#x27;));
	      this.fillDow();
	      this.fillMonths();
	      this.fillHours();
	      this.fillMinutes();
	      this.fillSeconds();
	      this.update();
	      this.showMode();
	      this._attachDatePickerEvents();
	      this.setValue(this._date.getTime());
	    },
	
	    /**
	     * 显示
	     * @method show
	     * @param event
	     */
	    show: function(e) {
	      this.widget.show();
	      this.height = this.component ? this.component.outerHeight() : this.$element.outerHeight();
	      this.place();
	      this.$element.trigger({
	        type: &#x27;show&#x27;,
	        date: this._date
	      });
	      this._attachDatePickerGlobalEvents();
	      if (e) {
	        e.stopPropagation();
	        e.preventDefault();
	      }
	    },
	
	    /**
	     * 设置不可用
	     * @method disable
	     */
	    disable: function(){
	          this.$element.find(&#x27;input&#x27;).prop(&#x27;disabled&#x27;,true);
	          this._detachDatePickerEvents();
	    },
	    
	    /**
	     * 设置可用
	     * @method enable
	     */
	    enable: function(){
	          this.$element.find(&#x27;input&#x27;).prop(&#x27;disabled&#x27;,false);
	          this._attachDatePickerEvents();
	    },
	
	    /**
	     * 隐藏
	     * @method hide
	     * @param event
	     */
	    hide: function(e) {
	      // Ignore event if in the middle of a picker transition
	      var collapse = this.widget.find(&#x27;.collapse&#x27;)
	      for (var i = 0; i &lt; collapse.length; i++) {
	        var collapseData = collapse.eq(i).data(&#x27;collapse&#x27;);
	        if (collapseData &amp;&amp; collapseData.transitioning)
	          return;
	      }
	      this.widget.hide();
	      this.viewMode = this.startViewMode;
	      this.showMode();
	      this.set();
	      this.$element.trigger({
	        type: &#x27;hide&#x27;,
	        date: this._date
	      });
	      this._detachDatePickerGlobalEvents();
	    },
	
	    set: function() {
	      var formatted = &#x27;&#x27;;
	      if (!this._unset) formatted = this.formatDate(this._date);
	      if (!this.isInput) {
	        if (this.component){
	          var input = this.$element.find(&#x27;input&#x27;);
	          input.val(formatted);
	          this._resetMaskPos(input);
	        }
	        this.$element.data(&#x27;date&#x27;, formatted);
	      } else {
	        this.$element.val(formatted);
	        this._resetMaskPos(this.$element);
	      }
	    },
	
	    /**
	     * 设置UTC格式的日期
	     * @method setValue
	     * @param newDate(Date/String)
	     */
	    setValue: function(newDate) {
	      if (!newDate) {
	        this._unset = true;
	      } else {
	        this._unset = false;
	      }
	      if (typeof newDate === &#x27;string&#x27;) {
	        this._date = this.parseDate(newDate);
	      } else if(newDate) {
	        this._date = new Date(newDate);
	      }
	      this.set();
	      this.viewDate = UTCDate(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0);
	      this.fillDate();
	      this.fillTime();
	    },
	
	    /**
	     * 获取当前UTC格式日期
	     * @method getDate
	     * @returns Date
	     */
	    getDate: function() {
	      if (this._unset) return null;
	      return new Date(this._date.valueOf());
	    },
	    
	    /**
	     * 获取当前UTC格式日期字符串
	     * @method getValue
	     * @returns String
	     */
	    getValue: function(){
	    	if(this.pickDate &amp;&amp; !this.pickTime){
	    		return {&#x27;year&#x27;:this._date.getFullYear(), &#x27;month&#x27;:this._date.getMonth() + 1,
	    			&#x27;day&#x27;:this._date.getDate()};
	    	}else if(!this.pickDate &amp;&amp; this.pickTime){
	    		return {&#x27;hour&#x27;:this._date.getUTCHours(), &#x27;minutes&#x27;:this._date.getMinutes(), 
	    			&#x27;second&#x27;:this._date.getSeconds()};	
	    	}else{
	    		return {&#x27;year&#x27;:this._date.getFullYear(), &#x27;month&#x27;:this._date.getMonth() + 1, 
	    			&#x27;day&#x27;:this._date.getDate(),&#x27;hour&#x27;:this._date.getUTCHours(), &#x27;minutes&#x27;:this._date.getMinutes(), 
	    			&#x27;second&#x27;:this._date.getSeconds()};
	    	}
	    },
	    
	    /**
	     * 设置UTC格式的日期
	     * @method setDate
	     * @param date(Date)
	     */
	    setDate: function(date) {
	      if (!date) this.setValue(null);
	      else this.setValue(date.valueOf());
	    },
	
	    /**
	     * 设置开始日期
	     * @method setStartDate
	     * @param date(Date/String)
	     */
	    setStartDate: function(date) {
	      if (date instanceof Date) {
	        this.startDate = date;
	      } else if (typeof date === &#x27;string&#x27;) {
	        this.startDate = new UTCDate(date);
	        if (! this.startDate.getUTCFullYear()) {
	          this.startDate = -Infinity;
	        }
	      } else {
	        this.startDate = -Infinity;
	      }
	      if (this.viewDate) {
	        this.update();
	      }
	    },
	
	    /**
	     * 设置结束日期
	     * @method setEndDate
	     * @param date(Date/String)
	     */
	    setEndDate: function(date) {
	      if (date instanceof Date) {
	        this.endDate = date;
	      } else if (typeof date === &#x27;string&#x27;) {
	        this.endDate = new UTCDate(date);
	        if (! this.endDate.getUTCFullYear()) {
	          this.endDate = Infinity;
	        }
	      } else {
	        this.endDate = Infinity;
	      }
	      if (this.viewDate) {
	        this.update();
	      }
	    },
	
	    /**
	     * 获取当前本地格式日期
	     * @method getLocalDate
	     * @returns Date
	     */
	    getLocalDate: function() {
	      if (this._unset) return null;
	      var d = this._date;
	      return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(),
	                      d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
	    },
	
	    /**
	     * 设置当前本地格式日期
	     * @method setLocalDate
	     * @param localDate(Date/String)
	     */
	    setLocalDate: function(localDate) {
	      if (!localDate) this.setValue(null);
	      else
	        this.setValue(Date.UTC(
	          localDate.getFullYear(),
	          localDate.getMonth(),
	          localDate.getDate(),
	          localDate.getHours(),
	          localDate.getMinutes(),
	          localDate.getSeconds(),
	          localDate.getMilliseconds()));
	    },
	
	    place: function(){
	      var position = &#x27;absolute&#x27;;
	      var offset = this.component ? this.component.offset() : this.$element.offset();
	      this.width = this.component ? this.component.outerWidth() : this.$element.outerWidth();
	      offset.top = offset.top + this.height;
	
	      var $window = $(window);
	      
	      if ( this.options.width != undefined ) {
	        this.widget.width( this.options.width );
	      }
	      
	      if ( this.options.orientation == &#x27;left&#x27; ) {
	        this.widget.addClass( &#x27;left-oriented&#x27; );
	        offset.left   = offset.left - this.widget.width() + 20;
	      }
	      
	      if (this._isInFixed()) {
	        position = &#x27;fixed&#x27;;
	        offset.top -= $window.scrollTop();
	        offset.left -= $window.scrollLeft();
	      }
	
	      if ($window.width() &lt; offset.left + this.widget.outerWidth()) {
	        offset.right = $window.width() - offset.left - this.width;
	        offset.left = &#x27;auto&#x27;;
	        this.widget.addClass(&#x27;pull-right&#x27;);
	      } else {
	        offset.right = &#x27;auto&#x27;;
	        this.widget.removeClass(&#x27;pull-right&#x27;);
	      }
	
	      this.widget.css({
	        position: position,
	        top: offset.top,
	        left: offset.left,
	        right: offset.right
	      });
	    },
	
	    notifyChange: function(){
	      this.$element.trigger({
	        type: &#x27;changeDate&#x27;,
	        date: this.getDate(),
	        localDate: this.getLocalDate()
	      });
	    },
	
	  	/**
	     * 更新日期
	     * @method update
	     * @param newDate(Date/String)
	     */
	    update: function(newDate){
	      var dateStr = newDate;
	      if (!dateStr) {
	        if (this.isInput) {
	          dateStr = this.$element.val();
	        } else {
	          dateStr = this.$element.find(&#x27;input&#x27;).val();
	        }
	        if (dateStr) {
	          this._date = this.parseDate(dateStr);
	        }
	        if (!this._date) {
	          var tmp = new Date()
	          this._date = UTCDate(tmp.getFullYear(),
	                              tmp.getMonth(),
	                              tmp.getDate(),
	                              tmp.getHours(),
	                              tmp.getMinutes(),
	                              tmp.getSeconds(),
	                              tmp.getMilliseconds())
	        }
	      }
	      this.viewDate = UTCDate(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0);
	      this.fillDate();
	      this.fillTime();
	    },
	
	    fillDow: function() {
	      var dowCnt = this.weekStart;
	      var html = $(&#x27;&lt;tr&gt;&#x27;);
	      while (dowCnt &lt; this.weekStart + 7) {
	        html.append(&#x27;&lt;th class=&quot;dow&quot;&gt;&#x27; + dates[this.language].daysMin[(dowCnt++) % 7] + &#x27;&lt;/th&gt;&#x27;);
	      }
	      this.widget.find(&#x27;.datepicker-days thead&#x27;).append(html);
	    },
	
	    fillMonths: function() {
	      var html = &#x27;&#x27;;
	      var i = 0
	      while (i &lt; 12) {
	        html += &#x27;&lt;span class=&quot;month&quot;&gt;&#x27; + dates[this.language].monthsShort[i++] + &#x27;&lt;/span&gt;&#x27;;
	      }
	      this.widget.find(&#x27;.datepicker-months td&#x27;).append(html);
	    },
	
	    fillDate: function() {
	      var year = this.viewDate.getUTCFullYear();
	      var month = this.viewDate.getUTCMonth();
	      var currentDate = UTCDate(
	        this._date.getUTCFullYear(),
	        this._date.getUTCMonth(),
	        this._date.getUTCDate(),
	        0, 0, 0, 0
	      );
	      var startYear  = typeof this.startDate === &#x27;object&#x27; ? this.startDate.getUTCFullYear() : -Infinity;
	      var startMonth = typeof this.startDate === &#x27;object&#x27; ? this.startDate.getUTCMonth() : -1;
	      var endYear  = typeof this.endDate === &#x27;object&#x27; ? this.endDate.getUTCFullYear() : Infinity;
	      var endMonth = typeof this.endDate === &#x27;object&#x27; ? this.endDate.getUTCMonth() : 12;
	
	      this.widget.find(&#x27;.datepicker-days&#x27;).find(&#x27;.disabled&#x27;).removeClass(&#x27;disabled&#x27;);
	      this.widget.find(&#x27;.datepicker-months&#x27;).find(&#x27;.disabled&#x27;).removeClass(&#x27;disabled&#x27;);
	      this.widget.find(&#x27;.datepicker-years&#x27;).find(&#x27;.disabled&#x27;).removeClass(&#x27;disabled&#x27;);
	
	      this.widget.find(&#x27;.datepicker-days th:eq(1)&#x27;).text(
	    		  year + &quot;-&quot; + dates[this.language].months[month]);
	
	      var prevMonth = UTCDate(year, month-1, 28, 0, 0, 0, 0);
	      var day = DPGlobal.getDaysInMonth(
	        prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
	      prevMonth.setUTCDate(day);
	      prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);
	      if ((year == startYear &amp;&amp; month &lt;= startMonth) || year &lt; startYear) {
	        this.widget.find(&#x27;.datepicker-days th:eq(0)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	      if ((year == endYear &amp;&amp; month &gt;= endMonth) || year &gt; endYear) {
	        this.widget.find(&#x27;.datepicker-days th:eq(2)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	
	      var nextMonth = new Date(prevMonth.valueOf());
	      nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
	      nextMonth = nextMonth.valueOf();
	      var html = [];
	      var row;
	      var clsName;
	      while (prevMonth.valueOf() &lt; nextMonth) {
	        if (prevMonth.getUTCDay() === this.weekStart) {
	          row = $(&#x27;&lt;tr&gt;&#x27;);
	          html.push(row);
	        }
	        clsName = &#x27;&#x27;;
	        if (prevMonth.getUTCFullYear() &lt; year ||
	            (prevMonth.getUTCFullYear() == year &amp;&amp;
	             prevMonth.getUTCMonth() &lt; month)) {
	          clsName += &#x27; old&#x27;;
	        } else if (prevMonth.getUTCFullYear() &gt; year ||
	                   (prevMonth.getUTCFullYear() == year &amp;&amp;
	                    prevMonth.getUTCMonth() &gt; month)) {
	          clsName += &#x27; new&#x27;;
	        }
	        if (prevMonth.valueOf() === currentDate.valueOf()) {
	          clsName += &#x27; active&#x27;;
	        }
	        if ((prevMonth.valueOf() + 86400000) &lt;= this.startDate) {
	          clsName += &#x27; disabled&#x27;;
	        }
	        if (prevMonth.valueOf() &gt; this.endDate) {
	          clsName += &#x27; disabled&#x27;;
	        }
	        row.append(&#x27;&lt;td class=&quot;day&#x27; + clsName + &#x27;&quot;&gt;&#x27; + prevMonth.getUTCDate() + &#x27;&lt;/td&gt;&#x27;);
	        prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
	      }
	      this.widget.find(&#x27;.datepicker-days tbody&#x27;).empty().append(html);
	      var currentYear = this._date.getUTCFullYear();
	
	      var months = this.widget.find(&#x27;.datepicker-months&#x27;).find(
	        &#x27;th:eq(1)&#x27;).text(year).end().find(&#x27;span&#x27;).removeClass(&#x27;active&#x27;);
	      if (currentYear === year) {
	        months.eq(this._date.getUTCMonth()).addClass(&#x27;active&#x27;);
	      }
	      if (currentYear - 1 &lt; startYear) {
	        this.widget.find(&#x27;.datepicker-months th:eq(0)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	      if (currentYear + 1 &gt; endYear) {
	        this.widget.find(&#x27;.datepicker-months th:eq(2)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	      for (var i = 0; i &lt; 12; i++) {
	        if ((year == startYear &amp;&amp; startMonth &gt; i) || (year &lt; startYear)) {
	          $(months[i]).addClass(&#x27;disabled&#x27;);
	        } else if ((year == endYear &amp;&amp; endMonth &lt; i) || (year &gt; endYear)) {
	          $(months[i]).addClass(&#x27;disabled&#x27;);
	        }
	      }
	
	      html = &#x27;&#x27;;
	      year = parseInt(year/10, 10) * 10;
	      var yearCont = this.widget.find(&#x27;.datepicker-years&#x27;).find(
	        &#x27;th:eq(1)&#x27;).text(year + &#x27;-&#x27; + (year + 9)).end().find(&#x27;td&#x27;);
	      this.widget.find(&#x27;.datepicker-years&#x27;).find(&#x27;th&#x27;).removeClass(&#x27;disabled&#x27;);
	      if (startYear &gt; year) {
	        this.widget.find(&#x27;.datepicker-years&#x27;).find(&#x27;th:eq(0)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	      if (endYear &lt; year+9) {
	        this.widget.find(&#x27;.datepicker-years&#x27;).find(&#x27;th:eq(2)&#x27;).addClass(&#x27;disabled&#x27;);
	      }
	      year -= 1;
	      for (var i = -1; i &lt; 11; i++) {
	        html += &#x27;&lt;span class=&quot;year&#x27; + (i === -1 || i === 10 ? &#x27; old&#x27; : &#x27;&#x27;) + (currentYear === year ? &#x27; active&#x27; : &#x27;&#x27;) + ((year &lt; startYear || year &gt; endYear) ? &#x27; disabled&#x27; : &#x27;&#x27;) + &#x27;&quot;&gt;&#x27; + year + &#x27;&lt;/span&gt;&#x27;;
	        year += 1;
	      }
	      yearCont.html(html);
	    },
	
	    fillHours: function() {
	      var table = this.widget.find(
	        &#x27;.timepicker .timepicker-hours table&#x27;);
	      table.parent().hide();
	      var html = &#x27;&#x27;;
	      if (this.options.pick12HourFormat) {
	        var current = 1;
	        for (var i = 0; i &lt; 3; i += 1) {
	          html += &#x27;&lt;tr&gt;&#x27;;
	          for (var j = 0; j &lt; 4; j += 1) {
	             var c = current.toString();
	             html += &#x27;&lt;td class=&quot;hour&quot;&gt;&#x27; + padLeft(c, 2, &#x27;0&#x27;) + &#x27;&lt;/td&gt;&#x27;;
	             current++;
	          }
	          html += &#x27;&lt;/tr&gt;&#x27;;
	        }
	      } else {
	        var current = 0;
	        for (var i = 0; i &lt; 6; i += 1) {
	          html += &#x27;&lt;tr&gt;&#x27;;
	          for (var j = 0; j &lt; 4; j += 1) {
	             var c = current.toString();
	             html += &#x27;&lt;td class=&quot;hour&quot;&gt;&#x27; + padLeft(c, 2, &#x27;0&#x27;) + &#x27;&lt;/td&gt;&#x27;;
	             current++;
	          }
	          html += &#x27;&lt;/tr&gt;&#x27;
	        }
	      }
	      table.html(html);
	    },
	
	    fillMinutes: function() {
	      var table = this.widget.find(
	        &#x27;.timepicker .timepicker-minutes table&#x27;);
	      table.parent().hide();
	      var html = &#x27;&#x27;;
	      var current = 0;
	      for (var i = 0; i &lt; 5; i++) {
	        html += &#x27;&lt;tr&gt;&#x27;;
	        for (var j = 0; j &lt; 4; j += 1) {
	          var c = current.toString();
	          html += &#x27;&lt;td class=&quot;minute&quot;&gt;&#x27; + padLeft(c, 2, &#x27;0&#x27;) + &#x27;&lt;/td&gt;&#x27;;
	          current += 3;
	        }
	        html += &#x27;&lt;/tr&gt;&#x27;;
	      }
	      table.html(html);
	    },
	
	    fillSeconds: function() {
	      var table = this.widget.find(
	        &#x27;.timepicker .timepicker-seconds table&#x27;);
	      table.parent().hide();
	      var html = &#x27;&#x27;;
	      var current = 0;
	      for (var i = 0; i &lt; 5; i++) {
	        html += &#x27;&lt;tr&gt;&#x27;;
	        for (var j = 0; j &lt; 4; j += 1) {
	          var c = current.toString();
	          html += &#x27;&lt;td class=&quot;second&quot;&gt;&#x27; + padLeft(c, 2, &#x27;0&#x27;) + &#x27;&lt;/td&gt;&#x27;;
	          current += 3;
	        }
	        html += &#x27;&lt;/tr&gt;&#x27;;
	      }
	      table.html(html);
	    },
	
	    fillTime: function() {
	      if (!this._date)
	        return;
	      var timeComponents = this.widget.find(&#x27;.timepicker span[data-time-component]&#x27;);
	      var table = timeComponents.closest(&#x27;table&#x27;);
	      var is12HourFormat = this.options.pick12HourFormat;
	      var hour = this._date.getUTCHours();
	      var period = &#x27;AM&#x27;;
	      if (is12HourFormat) {
	        if (hour &gt;= 12) period = &#x27;PM&#x27;;
	        if (hour === 0) hour = 12;
	        else if (hour != 12) hour = hour % 12;
	        this.widget.find(
	          &#x27;.timepicker [data-action=togglePeriod]&#x27;).text(period);
	      }
	      hour = padLeft(hour.toString(), 2, &#x27;0&#x27;);
	      var minute = padLeft(this._date.getUTCMinutes().toString(), 2, &#x27;0&#x27;);
	      var second = padLeft(this._date.getUTCSeconds().toString(), 2, &#x27;0&#x27;);
	      timeComponents.filter(&#x27;[data-time-component=hours]&#x27;).text(hour);
	      timeComponents.filter(&#x27;[data-time-component=minutes]&#x27;).text(minute);
	      timeComponents.filter(&#x27;[data-time-component=seconds]&#x27;).text(second);
	    },
	
	    click: function(e) {
	      e.stopPropagation();
	      e.preventDefault();
	      this._unset = false;
	      var target = $(e.target).closest(&#x27;span, td, th&#x27;);
	      if (target.length === 1) {
	        if (! target.is(&#x27;.disabled&#x27;)) {
	          switch(target[0].nodeName.toLowerCase()) {
	            case &#x27;th&#x27;:
	              switch(target[0].className) {
	                case &#x27;switch&#x27;:
	                  this.showMode(1);
	                  break;
	                case &#x27;prev&#x27;:
	                case &#x27;next&#x27;:
	                  var vd = this.viewDate;
	                  var navFnc = DPGlobal.modes[this.viewMode].navFnc;
	                  var step = DPGlobal.modes[this.viewMode].navStep;
	                  if (target[0].className === &#x27;prev&#x27;) step = step * -1;
	                  vd[&#x27;set&#x27; + navFnc](vd[&#x27;get&#x27; + navFnc]() + step);
	                  this.fillDate();
	                  this.set();
	                  break;
	              }
	              break;
	            case &#x27;span&#x27;:
	              if (target.is(&#x27;.month&#x27;)) {
	                var month = target.parent().find(&#x27;span&#x27;).index(target);
	                this.viewDate.setUTCMonth(month);
	              } else {
	                var year = parseInt(target.text(), 10) || 0;
	                this.viewDate.setUTCFullYear(year);
	              }
	              if (this.viewMode !== 0) {
	                this._date = UTCDate(
	                  this.viewDate.getUTCFullYear(),
	                  this.viewDate.getUTCMonth(),
	                  this.viewDate.getUTCDate(),
	                  this._date.getUTCHours(),
	                  this._date.getUTCMinutes(),
	                  this._date.getUTCSeconds(),
	                  this._date.getUTCMilliseconds()
	                );
	                this.notifyChange();
	              }
	              this.showMode(-1);
	              this.fillDate();
	              this.set();
	              break;
	            case &#x27;td&#x27;:
	              if (target.is(&#x27;.day&#x27;)) {
	                var day = parseInt(target.text(), 10) || 1;
	                var month = this.viewDate.getUTCMonth();
	                var year = this.viewDate.getUTCFullYear();
	                if (target.is(&#x27;.old&#x27;)) {
	                  if (month === 0) {
	                    month = 11;
	                    year -= 1;
	                  } else {
	                    month -= 1;
	                  }
	                } else if (target.is(&#x27;.new&#x27;)) {
	                  if (month == 11) {
	                    month = 0;
	                    year += 1;
	                  } else {
	                    month += 1;
	                  }
	                }
	                this._date = UTCDate(
	                  year, month, day,
	                  this._date.getUTCHours(),
	                  this._date.getUTCMinutes(),
	                  this._date.getUTCSeconds(),
	                  this._date.getUTCMilliseconds()
	                );
	                this.viewDate = UTCDate(
	                  year, month, Math.min(28, day) , 0, 0, 0, 0);
	                this.fillDate();
	                this.set();
	                this.notifyChange();
	                if(this.pickDate &amp;&amp; !this.pickTime){
	                	this.hide();
	                }
	              }
	              break;
	          }
	        }
	      }
	    },
	
	    /**
	     * 动作列表
	     * @attribute actions
	     */
	    actions: {
	      incrementHours: function(e) {
	        this._date.setUTCHours(this._date.getUTCHours() + 1);
	      },
	
	      incrementMinutes: function(e) {
	        this._date.setUTCMinutes(this._date.getUTCMinutes() + 1);
	      },
	
	      incrementSeconds: function(e) {
	        this._date.setUTCSeconds(this._date.getUTCSeconds() + 1);
	      },
	
	      decrementHours: function(e) {
	        this._date.setUTCHours(this._date.getUTCHours() - 1);
	      },
	
	      decrementMinutes: function(e) {
	        this._date.setUTCMinutes(this._date.getUTCMinutes() - 1);
	      },
	
	      decrementSeconds: function(e) {
	        this._date.setUTCSeconds(this._date.getUTCSeconds() - 1);
	      },
	
	      togglePeriod: function(e) {
	        var hour = this._date.getUTCHours();
	        if (hour &gt;= 12) hour -= 12;
	        else hour += 12;
	        this._date.setUTCHours(hour);
	      },
	
	      showPicker: function() {
	        this.widget.find(&#x27;.timepicker &gt; div:not(.timepicker-picker)&#x27;).hide();
	        this.widget.find(&#x27;.timepicker .timepicker-picker&#x27;).show();
	      },
	
	      showHours: function() {
	        this.widget.find(&#x27;.timepicker .timepicker-picker&#x27;).hide();
	        this.widget.find(&#x27;.timepicker .timepicker-hours&#x27;).show();
	      },
	
	      showMinutes: function() {
	        this.widget.find(&#x27;.timepicker .timepicker-picker&#x27;).hide();
	        this.widget.find(&#x27;.timepicker .timepicker-minutes&#x27;).show();
	      },
	
	      showSeconds: function() {
	        this.widget.find(&#x27;.timepicker .timepicker-picker&#x27;).hide();
	        this.widget.find(&#x27;.timepicker .timepicker-seconds&#x27;).show();
	      },
	
	      selectHour: function(e) {
	        var tgt = $(e.target);
	        var value = parseInt(tgt.text(), 10);
	        if (this.options.pick12HourFormat) {
	          var current = this._date.getUTCHours();
	          if (current &gt;= 12) {
	            if (value != 12) value = (value + 12) % 24;
	          } else {
	            if (value === 12) value = 0;
	            else value = value % 12;
	          }
	        }
	        this._date.setUTCHours(value);
	        this.actions.showPicker.call(this);
	      },
	
	      selectMinute: function(e) {
	        var tgt = $(e.target);
	        var value = parseInt(tgt.text(), 10);
	        this._date.setUTCMinutes(value);
	        this.actions.showPicker.call(this);
	      },
	
	      selectSecond: function(e) {
	        var tgt = $(e.target);
	        var value = parseInt(tgt.text(), 10);
	        this._date.setUTCSeconds(value);
	        this.actions.showPicker.call(this);
	      }
	    },
	
	    doAction: function(e) {
	      e.stopPropagation();
	      e.preventDefault();
	      if (!this._date) this._date = UTCDate(1970, 0, 0, 0, 0, 0, 0);
	      var action = $(e.currentTarget).data(&#x27;action&#x27;);
	      var rv = this.actions[action].apply(this, arguments);
	      this.set();
	      this.fillTime();
	      this.notifyChange();
	      return rv;
	    },
	
	    stopEvent: function(e) {
	      e.stopPropagation();
	      e.preventDefault();
	    },
	
	    // part of the following code was taken from
	    // http://cloud.github.com/downloads/digitalBush/jquery.maskedinput/jquery.maskedinput-1.3.js
	    keydown: function(e) {
	      var self = this, k = e.which, input = $(e.target);
	      if (k == 8 || k == 46) {
	        // backspace and delete cause the maskPosition
	        // to be recalculated
	        setTimeout(function() {
	          self._resetMaskPos(input);
	        });
	      }
	    },
	
	    keypress: function(e) {
	      var k = e.which;
	      if (k == 8 || k == 46) {
	        // For those browsers which will trigger
	        // keypress on backspace/delete
	        return;
	      }
	      var input = $(e.target);
	      var c = String.fromCharCode(k);
	      var val = input.val() || &#x27;&#x27;;
	      val += c;
	      var mask = this._mask[this._maskPos];
	      if (!mask) {
	        return false;
	      }
	      if (mask.end != val.length) {
	        return;
	      }
	      if (!mask.pattern.test(val.slice(mask.start))) {
	        val = val.slice(0, val.length - 1);
	        while ((mask = this._mask[this._maskPos]) &amp;&amp; mask.character) {
	          val += mask.character;
	          // advance mask position past static
	          // part
	          this._maskPos++;
	        }
	        val += c;
	        if (mask.end != val.length) {
	          input.val(val);
	          return false;
	        } else {
	          if (!mask.pattern.test(val.slice(mask.start))) {
	            input.val(val.slice(0, mask.start));
	            return false;
	          } else {
	            input.val(val);
	            this._maskPos++;
	            return false;
	          }
	        }
	      } else {
	        this._maskPos++;
	      }
	    },
	
	    change: function(e) {
	      var input = $(e.target);
	      var val = input.val();
	      if (this._formatPattern.test(val)) {
	        this.update();
	        this.setValue(this._date.getTime());
	        this.notifyChange();
	        this.set();
	      } else if (val &amp;&amp; val.trim()) {
	        this.setValue(this._date.getTime());
	        if (this._date) this.set();
	        else input.val(&#x27;&#x27;);
	      } else {
	        if (this._date) {
	          this.setValue(null);
	          // unset the date when the input is
	          // erased
	          this.notifyChange();
	          this._unset = true;
	        }
	      }
	      this._resetMaskPos(input);
	    },
	
	    showMode: function(dir) {
	      if (dir) {
	        this.viewMode = Math.max(this.minViewMode, Math.min(
	          2, this.viewMode + dir));
	      }
	      this.widget.find(&#x27;.datepicker &gt; div&#x27;).hide().filter(
	        &#x27;.datepicker-&#x27;+DPGlobal.modes[this.viewMode].clsName).show();
	    },
	
	    /**
	     * 销毁整个日期时间组件
	     * @method destroy
	     */
	    destroy: function() {
	      this._detachDatePickerEvents();
	      this._detachDatePickerGlobalEvents();
	      this.widget.remove();
	      this.$element.removeData(&#x27;datetimepicker&#x27;);
	      this.component.removeData(&#x27;datetimepicker&#x27;);
	    },
	
	    formatDate: function(d) {
	      return this.format.replace(formatReplacer, function(match) {
	        var methodName, property, rv, len = match.length;
	        if (match === &#x27;ms&#x27;)
	          len = 1;
	        property = dateFormatComponents[match].property
	        if (property === &#x27;Hours12&#x27;) {
	          rv = d.getUTCHours();
	          if (rv === 0) rv = 12;
	          else if (rv !== 12) rv = rv % 12;
	        } else if (property === &#x27;Period12&#x27;) {
	          if (d.getUTCHours() &gt;= 12) return &#x27;PM&#x27;;
	          else return &#x27;AM&#x27;;
	        } else {
	          methodName = &#x27;get&#x27; + property;
	          rv = d[methodName]();
	        }
	        if (methodName === &#x27;getUTCMonth&#x27;) rv = rv + 1;
	        if (methodName === &#x27;getUTCYear&#x27;) rv = rv + 1900 - 2000;
	        return padLeft(rv.toString(), len, &#x27;0&#x27;);
	      });
	    },
	
	    parseDate: function(str) {
	      var match, i, property, methodName, value, parsed = {};
	      if (!(match = this._formatPattern.exec(str)))
	        return null;
	      for (i = 1; i &lt; match.length; i++) {
	        property = this._propertiesByIndex[i];
	        if (!property)
	          continue;
	        value = match[i];
	        if (/^\d+$/.test(value))
	          value = parseInt(value, 10);
	        parsed[property] = value;
	      }
	      return this._finishParsingDate(parsed);
	    },
	
	    _resetMaskPos: function(input) {
	      var val = input.val();
	      for (var i = 0; i &lt; this._mask.length; i++) {
	        if (this._mask[i].end &gt; val.length) {
	          // If the mask has ended then jump to
	          // the next
	          this._maskPos = i;
	          break;
	        } else if (this._mask[i].end === val.length) {
	          this._maskPos = i + 1;
	          break;
	        }
	      }
	    },
	
	    _finishParsingDate: function(parsed) {
	      var year, month, date, hours, minutes, seconds, milliseconds;
	      year = parsed.UTCFullYear;
	      if (parsed.UTCYear) year = 2000 + parsed.UTCYear;
	      if (!year) year = 1970;
	      if (parsed.UTCMonth) month = parsed.UTCMonth - 1;
	      else month = 0;
	      date = parsed.UTCDate || 1;
	      hours = parsed.UTCHours || 0;
	      minutes = parsed.UTCMinutes || 0;
	      seconds = parsed.UTCSeconds || 0;
	      milliseconds = parsed.UTCMilliseconds || 0;
	      if (parsed.Hours12) {
	        hours = parsed.Hours12;
	      }
	      if (parsed.Period12) {
	        if (/pm/i.test(parsed.Period12)) {
	          if (hours != 12) hours = (hours + 12) % 24;
	        } else {
	          hours = hours % 12;
	        }
	      }
	      return UTCDate(year, month, date, hours, minutes, seconds, milliseconds);
	    },
	
	    _compileFormat: function () {
	      var match, component, components = [], mask = [],
	      str = this.format, propertiesByIndex = {}, i = 0, pos = 0;
	      while (match = formatComponent.exec(str)) {
	        component = match[0];
	        if (component in dateFormatComponents) {
	          i++;
	          propertiesByIndex[i] = dateFormatComponents[component].property;
	          components.push(&#x27;\\s*&#x27; + dateFormatComponents[component].getPattern(
	            this) + &#x27;\\s*&#x27;);
	          mask.push({
	            pattern: new RegExp(dateFormatComponents[component].getPattern(
	              this)),
	            property: dateFormatComponents[component].property,
	            start: pos,
	            end: pos += component.length
	          });
	        }
	        else {
	          components.push(escapeRegExp(component));
	          mask.push({
	            pattern: new RegExp(escapeRegExp(component)),
	            character: component,
	            start: pos,
	            end: ++pos
	          });
	        }
	        str = str.slice(component.length);
	      }
	      this._mask = mask;
	      this._maskPos = 0;
	      this._formatPattern = new RegExp(
	        &#x27;^\\s*&#x27; + components.join(&#x27;&#x27;) + &#x27;\\s*$&#x27;);
	      this._propertiesByIndex = propertiesByIndex;
	    },
	
	    _attachDatePickerEvents: function() {
	      var self = this;
	      // this handles date picker clicks
	      this.widget.on(&#x27;click&#x27;, &#x27;.datepicker *&#x27;, $.proxy(this.click, this));
	      // this handles time picker clicks
	      this.widget.on(&#x27;click&#x27;, &#x27;[data-action]&#x27;, $.proxy(this.doAction, this));
	      this.widget.on(&#x27;mousedown&#x27;, $.proxy(this.stopEvent, this));
	      if (this.pickDate &amp;&amp; this.pickTime) {
	        this.widget.on(&#x27;click.togglePicker&#x27;, &#x27;.accordion-toggle&#x27;, function(e) {
	          e.stopPropagation();
	          var $this = $(this);
	          var $parent = $this.closest(&#x27;ul&#x27;);
	          var expanded = $parent.find(&#x27;.in&#x27;);
	          var closed = $parent.find(&#x27;.collapse:not(.in)&#x27;);
	
	          if (expanded &amp;&amp; expanded.length) {
	            var collapseData = expanded.data(&#x27;collapse&#x27;);
	            if (collapseData &amp;&amp; collapseData.transitioning) return;
	            expanded.collapse(&#x27;hide&#x27;);
	            closed.collapse(&#x27;show&#x27;);
	            if(window.ActiveXObject){
		            if(expanded.attr(&quot;index&quot;) == 1){
		                $parent.parent().height(156+$this.height());
		            }else{
		                $parent.parent().height(252+$this.height());
		            }
		         }
	            $this.find(&#x27;i&#x27;).toggleClass(self.timeIcon + &#x27; &#x27; + self.dateIcon);
	            self.$element.find(&#x27;.add-on i&#x27;).toggleClass(self.timeIcon + &#x27; &#x27; + self.dateIcon);
	          }
	        });
	      }
	      if (this.isInput) {
	        this.$element.on({
	          &#x27;focus&#x27;: $.proxy(this.show, this),
	          &#x27;change&#x27;: $.proxy(this.change, this)
	        });
	        if (this.options.maskInput) {
	          this.$element.on({
	            &#x27;keydown&#x27;: $.proxy(this.keydown, this),
	            &#x27;keypress&#x27;: $.proxy(this.keypress, this)
	          });
	        }
	      } else {
	        this.$element.on({
	          &#x27;change&#x27;: $.proxy(this.change, this)
	        }, &#x27;input&#x27;);
	        if (this.options.maskInput) {
	          this.$element.on({
	            &#x27;keydown&#x27;: $.proxy(this.keydown, this),
	            &#x27;keypress&#x27;: $.proxy(this.keypress, this)
	          }, &#x27;input&#x27;);
	        }
	        if (this.component){
	          this.component.on(&#x27;click&#x27;, $.proxy(this.show, this));
	        } else {
	          this.$element.on(&#x27;click&#x27;, $.proxy(this.show, this));
	        }
	      }
	    },
	
	    _attachDatePickerGlobalEvents: function() {
	      $(window).on(
	        &#x27;resize.datetimepicker&#x27; + this.id, $.proxy(this.place, this));
	      if (!this.isInput) {
	        $(document).on(
	          &#x27;mousedown.datetimepicker&#x27; + this.id, $.proxy(this.hide, this));
	      }
	    },
	
	    _detachDatePickerEvents: function() {
	      this.widget.off(&#x27;click&#x27;, &#x27;.datepicker *&#x27;, this.click);
	      this.widget.off(&#x27;click&#x27;, &#x27;[data-action]&#x27;);
	      this.widget.off(&#x27;mousedown&#x27;, this.stopEvent);
	      if (this.pickDate &amp;&amp; this.pickTime) {
	        this.widget.off(&#x27;click.togglePicker&#x27;);
	      }
	      if (this.isInput) {
	        this.$element.off({
	          &#x27;focus&#x27;: this.show,
	          &#x27;change&#x27;: this.change
	        });
	        if (this.options.maskInput) {
	          this.$element.off({
	            &#x27;keydown&#x27;: this.keydown,
	            &#x27;keypress&#x27;: this.keypress
	          });
	        }
	      } else {
	        this.$element.off({
	          &#x27;change&#x27;: this.change
	        }, &#x27;input&#x27;);
	        if (this.options.maskInput) {
	          this.$element.off({
	            &#x27;keydown&#x27;: this.keydown,
	            &#x27;keypress&#x27;: this.keypress
	          }, &#x27;input&#x27;);
	        }
	        if (this.component){
	          this.component.off(&#x27;click&#x27;, this.show);
	        } else {
	          this.$element.off(&#x27;click&#x27;, this.show);
	        }
	      }
	    },
	
	    _detachDatePickerGlobalEvents: function () {
	      $(window).off(&#x27;resize.datetimepicker&#x27; + this.id);
	      if (!this.isInput) {
	        $(document).off(&#x27;mousedown.datetimepicker&#x27; + this.id);
	      }
	    },
	
	    _isInFixed: function() {
	      if (this.$element) {
	        var parents = this.$element.parents();
	        var inFixed = false;
	        for (var i=0; i&lt;parents.length; i++) {
	            if ($(parents[i]).css(&#x27;position&#x27;) == &#x27;fixed&#x27;) {
	                inFixed = true;
	                break;
	            }
	        };
	        return inFixed;
	      } else {
	        return false;
	      }
	    }
	  };
	
	  $.fn.datetimepicker = function ( option, val ) {
	    return this.each(function () {
	      var $this = $(this),
	      data = $this.data(&#x27;koala.datetimepicker&#x27;),
	      options = typeof option === &#x27;object&#x27; &amp;&amp; option;
	      if (!data) {
	        $this.data(&#x27;koala.datetimepicker&#x27;, (data = new DateTimePicker(
	          this, $.extend({}, $.fn.datetimepicker.defaults,options))));
	      }
	      if (typeof option === &#x27;string&#x27;) data[option](val);
	    }).data(&#x27;koala.datetimepicker&#x27;);
	  };
	
	  //默认内置属性
	  $.fn.datetimepicker.defaults = {
		/**
		 * 输入框输入时是否校验日期时间格式的合法
		 * @property maskInput
		 * @type Boolean
		 * @default false
		 */
	    maskInput: false,
	    /**
	     * 是否显示日期选择
	     * @property pickDate
		 * @type Boolean
		 * @default true
	     */
	    pickDate: true,
	    /**
	     * 是否显示时间选择
	     * @property pickTime
		 * @type Boolean
		 * @default true
	     */
	    pickTime: true,
	    /**
	     * 是否以12小时格式显示
	     * @property pick12HourFormat
		 * @type Boolean
		 * @default false
	     */
	    pick12HourFormat: false,
	    /**
	     * 是否精确到秒
	     * @property pickSeconds
		 * @type Boolean
		 * @default true
	     */
	    pickSeconds: true,
	    /**
	     * 开始日期
	     * @property startDate
		 * @type String 或 Date
		 * @default -Infinity
	     */
	    startDate: -Infinity,
	    /**
	     * 结束日期
	     * @property endDate
		 * @type String 或 Date
		 * @default Infinity
	     */
	    endDate: Infinity,
	    /**
	     * 同时显示日期和时间的时候，是否通过折叠切换显示
	     * @property collapse
		 * @type Boolean
		 * @default true
	     */
	    collapse: true
	  };
	  $.fn.datetimepicker.Constructor = DateTimePicker;
	  var dpgId = 0;
	  var dates = $.fn.datetimepicker.dates = {
	    en: {
	      days: [&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;,
	        &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;],
	      daysShort: [&quot;Sun&quot;, &quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;],
	      daysMin: [&quot;Su&quot;, &quot;Mo&quot;, &quot;Tu&quot;, &quot;We&quot;, &quot;Th&quot;, &quot;Fr&quot;, &quot;Sa&quot;, &quot;Su&quot;],
	      months: [&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;,
	        &quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot;],
	      monthsShort: [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;,
	        &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;]
	    }
	  };
	  $.fn.datetimepicker.dates[&#x27;zh-CN&#x27;] = {
				days: [&quot;星期日&quot;, &quot;星期一&quot;, &quot;星期二&quot;, &quot;星期三&quot;, &quot;星期四&quot;, &quot;星期五&quot;, &quot;星期六&quot;, &quot;星期日&quot;],
				daysShort: [&quot;周日&quot;, &quot;周一&quot;, &quot;周二&quot;, &quot;周三&quot;, &quot;周四&quot;, &quot;周五&quot;, &quot;周六&quot;, &quot;周日&quot;],
				daysMin:  [&quot;日&quot;, &quot;一&quot;, &quot;二&quot;, &quot;三&quot;, &quot;四&quot;, &quot;五&quot;, &quot;六&quot;, &quot;日&quot;],
				months: [&quot;01&quot;, &quot;02&quot;, &quot;03&quot;, &quot;04&quot;, &quot;05&quot;, &quot;06&quot;, &quot;07&quot;, &quot;08&quot;, &quot;09&quot;, &quot;10&quot;, &quot;11&quot;, &quot;12&quot;],
				monthsShort: [&quot;01&quot;, &quot;02&quot;, &quot;03&quot;, &quot;04&quot;, &quot;05&quot;, &quot;06&quot;, &quot;07&quot;, &quot;08&quot;, &quot;09&quot;, &quot;10&quot;, &quot;11&quot;, &quot;12&quot;],
				today: &quot;今日&quot;,
				suffix: [],
				meridiem: []
	  };
	  var dateFormatComponents = {
	    dd: {property: &#x27;UTCDate&#x27;, getPattern: function() { return &#x27;(0?[1-9]|[1-2][0-9]|3[0-1])\\b&#x27;;}},
	    MM: {property: &#x27;UTCMonth&#x27;, getPattern: function() {return &#x27;(0?[1-9]|1[0-2])\\b&#x27;;}},
	    yy: {property: &#x27;UTCYear&#x27;, getPattern: function() {return &#x27;(\\d{2})\\b&#x27;;}},
	    yyyy: {property: &#x27;UTCFullYear&#x27;, getPattern: function() {return &#x27;(\\d{4})\\b&#x27;;}},
	    hh: {property: &#x27;UTCHours&#x27;, getPattern: function() {return &#x27;(0?[0-9]|1[0-9]|2[0-3])\\b&#x27;;}},
	    mm: {property: &#x27;UTCMinutes&#x27;, getPattern: function() {return &#x27;(0?[0-9]|[1-5][0-9])\\b&#x27;;}},
	    ss: {property: &#x27;UTCSeconds&#x27;, getPattern: function() {return &#x27;(0?[0-9]|[1-5][0-9])\\b&#x27;;}},
	    ms: {property: &#x27;UTCMilliseconds&#x27;, getPattern: function() {return &#x27;([0-9]{1,3})\\b&#x27;;}},
	    HH: {property: &#x27;Hours12&#x27;, getPattern: function() {return &#x27;(0?[1-9]|1[0-2])\\b&#x27;;}},
	    PP: {property: &#x27;Period12&#x27;, getPattern: function() {return &#x27;(AM|PM|am|pm|Am|aM|Pm|pM)\\b&#x27;;}}
	  };
	
	  var keys = [];
	  for (var k in dateFormatComponents) keys.push(k);
	  keys[keys.length - 1] += &#x27;\\b&#x27;;
	  keys.push(&#x27;.&#x27;);
	
	  var formatComponent = new RegExp(keys.join(&#x27;\\b|&#x27;));
	  keys.pop();
	  var formatReplacer = new RegExp(keys.join(&#x27;\\b|&#x27;), &#x27;g&#x27;);
	
	  function escapeRegExp(str) {
	    // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
	    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, &quot;\\$&amp;&quot;);
	  }
	
	  function padLeft(s, l, c) {
	    if (l &lt; s.length) return s;
	    else return Array(l - s.length + 1).join(c || &#x27; &#x27;) + s;
	  }
	
	  function getTemplate(timeIcon, pickDate, pickTime, is12Hours, showSeconds, collapse) {
	    if (pickDate &amp;&amp; pickTime) {
	      return (
	        &#x27;&lt;div class=&quot;datetimepicker&quot;&gt;&#x27; +
	          &#x27;&lt;ul&gt;&#x27; +
	            &#x27;&lt;li&#x27; + (collapse ? &#x27; index=&quot;1&quot; class=&quot;collapse in&quot;&#x27; : &#x27;&#x27;) + &#x27;&gt;&#x27; +
	              &#x27;&lt;div class=&quot;datepicker&quot;&gt;&#x27; +
	                DPGlobal.template +
	              &#x27;&lt;/div&gt;&#x27; +
	            &#x27;&lt;/li&gt;&#x27; +
	            &#x27;&lt;li  index=&quot;2&quot; class=&quot;picker-switch accordion-toggle&quot;&gt;&lt;a&gt;&lt;i class=&quot;&#x27; + timeIcon + &#x27;&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;&#x27; +
	            &#x27;&lt;li&#x27; + (collapse ? &#x27;  index=&quot;3&quot; class=&quot;collapse&quot;&#x27; : &#x27;&#x27;) + &#x27;&gt;&#x27; +
	              &#x27;&lt;div class=&quot;timepicker&quot;&gt;&#x27; +
	               TPGlobal.getTemplate(is12Hours, showSeconds) +
	              &#x27;&lt;/div&gt;&#x27; +
	            &#x27;&lt;/li&gt;&#x27; +
	          &#x27;&lt;/ul&gt;&#x27; +
	        &#x27;&lt;/div&gt;&#x27;
	      );
	    } else if (pickTime) {
	      return (
	        &#x27;&lt;div class=&quot;datetimepicker&quot;&gt;&#x27; +
	          &#x27;&lt;div class=&quot;timepicker&quot;&gt;&#x27; +
	            TPGlobal.getTemplate(is12Hours, showSeconds) +
	          &#x27;&lt;/div&gt;&#x27; +
	        &#x27;&lt;/div&gt;&#x27;
	      );
	    } else {
	      return (
	        &#x27;&lt;div class=&quot;datetimepicker&quot;&gt;&#x27; +
	          &#x27;&lt;div class=&quot;datepicker&quot;&gt;&#x27; +
	            DPGlobal.template +
	          &#x27;&lt;/div&gt;&#x27; +
	        &#x27;&lt;/div&gt;&#x27;
	      );
	    }
	  }
	
	  function UTCDate() {
	    return new Date(Date.UTC.apply(Date, arguments));
	  }
	
//	  /**
//	   * 日期选择器全局对象
//	   * @class DPGlobal
//	   */
	  var DPGlobal = {
//		/**
//		 * 日期模式
//		 * @property modes
//		 * @type Array
//		 * @default 包括年/月/日的模式的对象数组
//		 */
	    modes: [
	      {
	      clsName: &#x27;days&#x27;,
	      navFnc: &#x27;UTCMonth&#x27;,
	      navStep: 1
	    },
	    {
	      clsName: &#x27;months&#x27;,
	      navFnc: &#x27;UTCFullYear&#x27;,
	      navStep: 1
	    },
	    {
	      clsName: &#x27;years&#x27;,
	      navFnc: &#x27;UTCFullYear&#x27;,
	      navStep: 10
	    }],
//	    /**
//	     * 判断是否润年
//	     * @method isLeapYear
//	     * @param {Integer} year
//	     * @return {Boolean} true/false
//	     */
	    isLeapYear: function (year) {
	      return (((year % 4 === 0) &amp;&amp; (year % 100 !== 0)) || (year % 400 === 0));
	    },
//	    /**
//	     * 获取一年里每个月的总天数
//	     * @method getDaysInMonth
//	     * @param {Integer} year
//	     * @param {Integer} month
//	     * @return {Integer} 天数
//	     */
	    getDaysInMonth: function (year, month) {
	      return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
	    },
//	    /**
//	     * 头部模板html
//	     * @property headTemplate
//	     * @type String
//	     */
	    headTemplate:
	      &#x27;&lt;thead&gt;&#x27; +
	        &#x27;&lt;tr&gt;&#x27; +
	          &#x27;&lt;th class=&quot;prev&quot;&gt;&amp;lsaquo;&lt;/th&gt;&#x27; +
	          &#x27;&lt;th colspan=&quot;5&quot; class=&quot;switch&quot;&gt;&lt;/th&gt;&#x27; +
	          &#x27;&lt;th class=&quot;next&quot;&gt;&amp;rsaquo;&lt;/th&gt;&#x27; +
	        &#x27;&lt;/tr&gt;&#x27; +
	      &#x27;&lt;/thead&gt;&#x27;,
	    /**
	     * 内容模板html
	     * @property contTemplate
	     * @type String
	     */
	    contTemplate: &#x27;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan=&quot;7&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&#x27;
	  };
//	  /**
//	   * 日期选择器的模板html
//	   * @attribute template
//	   * @for DPGlobal
//	   */
	  DPGlobal.template =
	    &#x27;&lt;div class=&quot;datepicker-days&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27; +
	        DPGlobal.headTemplate +
	        &#x27;&lt;tbody&gt;&lt;/tbody&gt;&#x27; +
	      &#x27;&lt;/table&gt;&#x27; +
	    &#x27;&lt;/div&gt;&#x27; +
	    &#x27;&lt;div class=&quot;datepicker-months&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27; +
	        DPGlobal.headTemplate +
	        DPGlobal.contTemplate+
	      &#x27;&lt;/table&gt;&#x27;+
	    &#x27;&lt;/div&gt;&#x27;+
	    &#x27;&lt;div class=&quot;datepicker-years&quot;&gt;&#x27;+
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27;+
	        DPGlobal.headTemplate+
	        DPGlobal.contTemplate+
	      &#x27;&lt;/table&gt;&#x27;+
	    &#x27;&lt;/div&gt;&#x27;;
//	  /**
//	   * 时间选择器对象
//	   * @class TPGlobal
//	   */
	  var TPGlobal = {
//		/**
//		 * 小时html模板
//		 * @property hourTemplate
//		 * @type String
//		 */
	    hourTemplate: &#x27;&lt;span data-action=&quot;showHours&quot; data-time-component=&quot;hours&quot; class=&quot;timepicker-hour&quot;&gt;&lt;/span&gt;&#x27;,
//	    /**
//		 * 分钟html模板
//		 * @property minuteTemplate
//		 * @type String
//		 */
	    minuteTemplate: &#x27;&lt;span data-action=&quot;showMinutes&quot; data-time-component=&quot;minutes&quot; class=&quot;timepicker-minute&quot;&gt;&lt;/span&gt;&#x27;,
//	    /**
//		 * 秒html模板
//		 * @property secondTemplate
//		 * @type String
//		 */
	    secondTemplate: &#x27;&lt;span data-action=&quot;showSeconds&quot; data-time-component=&quot;seconds&quot; class=&quot;timepicker-second&quot;&gt;&lt;/span&gt;&#x27;
	  };
//	  /**
//	   * @method getTemplate
//	   * @param {Boolean} is12Hours
//	   * 	是否十二小时制
//	   * @param showSeconds
//	   * 	是否显示秒
//	   * @for TPGlobal
//	   */
	  TPGlobal.getTemplate = function(is12Hours, showSeconds) {
	    return (
	    &#x27;&lt;div class=&quot;timepicker-picker&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&#x27; +
	        (is12Hours ? &#x27; data-hour-format=&quot;12&quot;&#x27; : &#x27;&#x27;) +
	        &#x27;&gt;&#x27; +
	        &#x27;&lt;tr&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;incrementHours&quot;&gt;&lt;i class=&quot;icon-chevron-up&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;incrementMinutes&quot;&gt;&lt;i class=&quot;icon-chevron-up&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27; +
	          (showSeconds ?
	          &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;incrementSeconds&quot;&gt;&lt;i class=&quot;icon-chevron-up&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27;: &#x27;&#x27;)+
	          (is12Hours ? &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; : &#x27;&#x27;) +
	        &#x27;&lt;/tr&gt;&#x27; +
	        &#x27;&lt;tr&gt;&#x27; +
	          &#x27;&lt;td&gt;&#x27; + TPGlobal.hourTemplate + &#x27;&lt;/td&gt; &#x27; +
	          &#x27;&lt;td class=&quot;separator&quot;&gt;:&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&#x27; + TPGlobal.minuteTemplate + &#x27;&lt;/td&gt; &#x27; +
	          (showSeconds ?
	          &#x27;&lt;td class=&quot;separator&quot;&gt;:&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&#x27; + TPGlobal.secondTemplate + &#x27;&lt;/td&gt;&#x27; : &#x27;&#x27;) +
	          (is12Hours ?
	          &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&#x27; +
	          &#x27;&lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot; data-action=&quot;togglePeriod&quot;&gt;&lt;/button&gt;&#x27; +
	          &#x27;&lt;/td&gt;&#x27; : &#x27;&#x27;) +
	        &#x27;&lt;/tr&gt;&#x27; +
	        &#x27;&lt;tr&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;decrementHours&quot;&gt;&lt;i class=&quot;icon-chevron-down&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;decrementMinutes&quot;&gt;&lt;i class=&quot;icon-chevron-down&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27; +
	          (showSeconds ?
	          &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; +
	          &#x27;&lt;td&gt;&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; data-action=&quot;decrementSeconds&quot;&gt;&lt;i class=&quot;icon-chevron-down&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&#x27;: &#x27;&#x27;) +
	          (is12Hours ? &#x27;&lt;td class=&quot;separator&quot;&gt;&lt;/td&gt;&#x27; : &#x27;&#x27;) +
	        &#x27;&lt;/tr&gt;&#x27; +
	      &#x27;&lt;/table&gt;&#x27; +
	    &#x27;&lt;/div&gt;&#x27; +
	    &#x27;&lt;div class=&quot;timepicker-hours&quot; data-action=&quot;selectHour&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27; +
	      &#x27;&lt;/table&gt;&#x27;+
	    &#x27;&lt;/div&gt;&#x27;+
	    &#x27;&lt;div class=&quot;timepicker-minutes&quot; data-action=&quot;selectMinute&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27; +
	      &#x27;&lt;/table&gt;&#x27;+
	    &#x27;&lt;/div&gt;&#x27;+
	    (showSeconds ?
	    &#x27;&lt;div class=&quot;timepicker-seconds&quot; data-action=&quot;selectSecond&quot;&gt;&#x27; +
	      &#x27;&lt;table class=&quot;table-condensed&quot;&gt;&#x27; +
	      &#x27;&lt;/table&gt;&#x27;+
	    &#x27;&lt;/div&gt;&#x27;: &#x27;&#x27;)
	    );
	  }
}(window.jQuery);
    </pre>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
